package com.hstc.config;

import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SaaLLMConfig {
    @Value("${spring.ai.dashscope.api-key}")
    private String apiKey;
//    方法一：
//    @Bean
//    public DashScopeApi dashScopeApi(){
//        return DashScopeApi.builder().apiKey(apiKey).build();
//    }
//    方法二：

    @Bean
    public DashScopeApi dashScopeApi(){
        return DashScopeApi.builder().apiKey(System.getenv("aliQwen-api")).build();
    }
}
